﻿// =================================================================== 
// 模块说明
//====================================================================
// 创建时间：2018-06-08 16:43:32
// 负责人：Sushee
// ===================================================================
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq.Expressions;
using Microsoft.Practices.EnterpriseLibrary.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using OF.Utility;
using OF.Component.Model;
using OF.Component.IDAL;
using System.Text;
namespace OF.Component.DAL
{
	
	/// <summary>
	///店铺图片 数据访问层
	/// </summary>	
	internal partial class ShopImg
	{		
    
        /// <summary>
    	/// 根据断言条件获取单个店铺图片
    	/// </summary>
        public ShopImgInfo QuerySingle(Expression<Func<ShopImgInfo, bool>> predicate)
	    {
            return SQLServerProvider.CreateObject(ConnectionStringKey, predicate);
        }
        /// <summary>
    	/// 根据断言条件获获取店铺图片列表
    	/// </summary>
	    public IList<ShopImgInfo> QueryList(Expression<Func<ShopImgInfo, bool>> predicate)
	    {
	        return SQLServerProvider.CreateList(ConnectionStringKey, predicate);
	    }

        /// <summary>
        /// 删除店铺展示图片
        /// </summary>
        /// <param name="shopId"></param>
        public void DeleteShopImgByShopId(int shopId)
        {
            string strSql = @"	  DELETE FROM [ShopImg] WHERE [ShopID]=@ShopID";
            Database db = DatabaseFactory.CreateDatabase(this.ConnectionStringKey);
            DbCommand dbc = db.GetSqlStringCommand(strSql);
            //设置参数
            db.AddInParameter(dbc, "@ShopID", DbType.Int32, shopId);
            try
            {
                db.ExecuteNonQuery(dbc);
            }
            catch
            {
                throw;
            }
        }

    }
	
}